<template>
  <div class="special-recommend">
    <h3 class="special-title">
      <i class="iconfont icon-special"></i> 专题推荐
    </h3>
    <div class="special-container">
      <div 
        v-for="special in specials" 
        :key="special.id"
        class="special-item"
      >
        <router-link :to="`/special/${special.id}`" class="special-link">
          <div class="special-image">
            <img 
              :src="special.cover" 
              :alt="special.title"
              loading="lazy"
            >
          </div>
          <div class="special-content">
            <h4 class="special-name">{{ special.title }}</h4>
            <p class="special-desc">{{ special.description }}</p>
            <div class="special-meta">
              <span class="meta-item">
                <i class="iconfont icon-file"></i> {{ special.articleCount }}篇文章
              </span>
              <span class="meta-item">
                <i class="iconfont icon-eye"></i> {{ special.viewCount }}浏览
              </span>
            </div>
          </div>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SpecialRecommend',
  props: {
    specials: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style scoped>
.special-recommend {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.special-title {
  font-size: 18px;
  margin: 0 0 20px;
  color: #333;
  display: flex;
  align-items: center;
}

.special-title i {
  margin-right: 8px;
  color: #FF6B6B;
}

.special-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.special-item {
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s;
}

.special-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.special-link {
  display: block;
  text-decoration: none;
  color: #333;
}

.special-image {
  height: 0;
  padding-bottom: 50%;
  position: relative;
  overflow: hidden;
}

.special-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.special-item:hover .special-image img {
  transform: scale(1.05);
}

.special-content {
  padding: 15px;
}

.special-name {
  font-size: 16px;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.special-desc {
  font-size: 13px;
  color: #666;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 36px;
}

.special-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #999;
}

.meta-item {
  display: flex;
  align-items: center;
}

.meta-item i {
  margin-right: 3px;
  font-size: 12px;
}

@media (max-width: 992px) {
  .special-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .special-container {
    grid-template-columns: 1fr;
  }
}
</style>